import React, {useRef } from "react";

function App() {
  const inputEle = useRef(null)
  const handleClick = () => {
    console.log(inputEle);
    console.log(inputEle.current);
    console.log(inputEle.current?.value)
  }

  return (
    <>
    <input ref={inputEle} type="text" />
    <button onClick={handleClick}>获取输入值</button>
    </>
  );
}
export default App;
